import {lazy} from 'react'

const Home = lazy(()=>import("../page/home"))
const Cart = lazy(()=>import("../page/cart"))
const Cate = lazy(()=>import("../page/cate"))
const Uncenter = lazy(()=>import("../page/uncenter"))
const Reg = lazy(()=>import("../page/Reg"))
const GoodsList = lazy(()=>import("../page/GoodsList"))
const GoodsDetail = lazy(()=>import("../page/GoodsDetail"))
const Login = lazy(()=>import("../page/Login"))
const Coupon = lazy(()=>import("../page/coupon"))


const rules=[
    {
        path: "/coupon",
        component: Coupon,
        exact: false,
        meta: {
            mustLogin: true,
            title: "优惠券"
        }
    },
    {
        path: "/login",
        component:Login ,
        exact: false,
        meta:{
            mustLogin:false,
            title:'会员登录'
        }
    },
    {
        path: "/reg",
        component: Reg,
        exact: false,
        meta:{
            mustLogin:false,
            title:'会员注册'
        }
    },
    {
        path: "/goods_list",
        component: GoodsList,
        exact: false,
        meta:{
            mustLogin:false,
            title:'商品列表'
        }
    },
    {
        path: "/goods_detail/",
        component: GoodsDetail,
        exact: false,
        meta:{
            mustLogin:false,
            title:'商品详情'
        }
    },
    {
        path: "/",
        redirect: "/home",
        exact: true,
        meta:{
            mustLogin:false,
            title:'小u商城'
        }
    },
    {
        path: "/home",
        component: Home,
        exact: false,
        meta:{
            mustLogin:false,
            title:'小u商城'
        }
    },
    {
        path: "/cart",
        component: Cart,
        exact: false,
        meta:{
            mustLogin:true,
            title:'购物车'
        }
    },
    {
        path: "/cate",
        component: Cate,
        exact: false,
        meta:{
            mustLogin:false,
            title:'商品分类'
        }
    },
    {
        path: "/uncenter",
        component: Uncenter,
        exact: false,
        meta:{
            mustLogin:true,
            title:'个人中心'
        }
    }
]

export default rules
